﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace DiveManager
{
    public partial class ManageRightsForm : Form
    {
        protected DiveDatabaseEntities diveDatabase;
        protected BindingSource bindingSourceGroups;
        protected BindingSource bindingSourceRights;

        public ManageRightsForm()
        {
            InitializeComponent();

            // Init Database
            diveDatabase = new DiveDatabaseEntities();
            bindingSourceGroups = new BindingSource();
            bindingSourceRights = new BindingSource();

            loadRightGroups();
        }

        private void ManageRightsForm_Load(object sender, EventArgs e)
        {

        }

        private void loadRightGroups()
        {
            IQueryable<SecurityGroups> dataQuery = (from a in diveDatabase.SecurityGroups
                                                    select a);

            // Bind Data to BindingSource
            bindingSourceGroups.DataSource = dataQuery;

            // Bind BindingSource to List
            this.dgRightGroups.DataSource = bindingSourceGroups;
        }
    }
}
